package com.app.service;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.app.dao.MenuDao;
import com.app.model.Menu;
import com.app.resp.MenuResponse;


@Service
public class MenuService {
	@Resource
	private MenuDao menuDao;
	
	public List<MenuResponse> findAll(){
		return menuDao.findAll();
	}
	
	public Map<String,String> findMenu(String url){
		return menuDao.findMenu(url);
	}
	
	public List<Menu> findAllByPage(String sql){
		return menuDao.findAllByPage(sql);
	}

	public Integer getCount(String sql) {
		return menuDao.getCount(sql);
	}

	public void save(Menu menu) {
		menuDao.save(menu);
	}
	
	public void update(Menu menu) {
		menuDao.update(menu);
	}
	
	public void delete(Long id) {
		menuDao.delete(id);
	}

	public Menu getById(Long id) {
		return menuDao.getById(id);
	}

	public List<Menu> getParentMenu() {
		return menuDao.getParentMenu();
	}
	
	public List<Menu> getSubMenu(Long pid) {
		return menuDao.getSubMenu(pid);
	}

	public List<Menu> findAllByTree() {
		return menuDao.findAllByTree();
	}
}
